package ebj.common.httpclient.download;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;

import ebj.common.logging.CommonLogger;

public class MultiThreadDownloaderTest {
	private static CommonLogger logger = new CommonLogger(MultiThreadDownloaderTest.class);
	
	public static void main(String[] args) {
		MultiThreadDownloader multiThreadDownloader = new MultiThreadDownloader();
		String url = "http://img.61gequ.com/allimg/2011-4/201142614314278502.jpg";
		String apk_download_url = "http://download.ymtech.com.s3.amazonaws.com/apk_files/com.lazyswipe.apk";
		String apk_download_url2 = "http://download.ymtech.com.s3.amazonaws.com/apk_files/net.slickdeals.android.apk";
		int threadNum = 5;
		try {
			multiThreadDownloader.download(apk_download_url2, threadNum);
		} catch (IOException e) {
			logger.error("", e);
		}
		
		try {
			boolean result = MultiThreadDownloader.fileIsDownloadingCompleted(apk_download_url, new File("com.lazyswipe.apk"));
			System.out.println(result);
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println();
	}
}
